// pages/cmmenu/index.js
const app = getApp();
Page({
  data: {
    hunFoodList: [],
    suFoodList: [],
    hasCheckFood: [],
    hasCheckFoodStr: ""
  },
  goOrderFood: function () {
    console.log("goOrderFood");
    wx.navigateTo({
      url: '../orderfood/index',
      success: function (res) {
        console.log("goOrderFoodres", res);
      },
      fail: function (res) { console.log("goOrderFoodres", res); },
      complete: function (res) { },
    })
  },
  onChange: function (event) {
    let that = this;
    console.log(event.detail.name);
    // let hcf = this.data.hasCheckFood;
    // hcf.push(event.detail.name);
    // that.setData({
    //   hasCheckFood: hcf
    // });
  },
  foodRefresh: function () {
    let that = this;
    let ru = app.globalData.requestUrl;
    wx.request({
      url: ru + '5c76425ecf44b',
      data: {
        request_Status: "cmmenu"
      },
      header: { version: "v3.0" },
      method: 'POST',
      dataType: 'json',
      responseType: 'text',
      success: function (res) {
        that.setData({
          hunFoodList: res.data.data.hunFoodList,
          suFoodList: res.data.data.suFoodList
        });
      }
    })
  },
  onLoad: function (options) {
    this.foodRefresh();
  },
  onShow: function () {
    this.foodRefresh();
  },
  onPullDownRefresh: function () {
    this.foodRefresh();
  }
})